package com.vf.admin.client.service.impl;

import com.vf.admin.client.dao.AppCommentDao;
import com.vf.admin.client.service.AppCommentService;
import com.vf.admin.common.splitpage.SplitPageBean;
import com.vf.admin.miaodong.entity.AppComment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class AppCommentServiceImpl implements AppCommentService {

    @Autowired
    AppCommentDao appCommentDao;

    @Override
    public void saveOrUpdate(AppComment appComment) {
        appCommentDao.save(appComment);
    }
    @Override
    public void pinglunSave(Integer dongtaiId,String message,Integer sex,String nick,String pic,String phone,Integer userid) {

        AppComment comment = new AppComment();
        comment.setCreatetime(new Date());
        comment.setDynamicid(dongtaiId);
        comment.setNeirong(message);
        comment.setSex(sex);
        comment.setNum(0);
        comment.setStatus(1);
        comment.setNick(nick);
        comment.setPic(pic);
        comment.setPhone(phone);
        comment.setUserid(userid);
        appCommentDao.save(comment);
    }

    @Override
    public AppComment getId(Integer id) {
        return appCommentDao.get(id);
    }
    @Override
    public List<AppComment> specificUserList(Integer dongtaiId, SplitPageBean splitPageBean) {
        return appCommentDao.specificUserList(dongtaiId, splitPageBean);
    }

    @Override
    public List<AppComment> listByDynamicId(Integer dynamicId) {
        return appCommentDao.listByDynamicId(dynamicId);
    }

    @Override
    public int plcount(Integer dongtaiId) {
        return appCommentDao.plcount(dongtaiId);
    }

    @Override
    public void updateStatus(Integer id, Integer status) {
        appCommentDao.updateStatus(id, status);
    }
    @Override
    public void updateZanNum(Integer id, Integer type) {
        appCommentDao.updateZanNum(id, type);
    }
}
